'\" te
.TH libsdp.conf 4 "20 Jun 2010"
.SH NAME
libsdp.conf \- configuration file for libsdp(3LIB) 
.SH SYNOPSIS
.LP
.nf
/etc/libsdp.conf
.fi

.SH DESCRIPTION
.sp
.LP
The \fB/etc/libsdp.conf\fR file is the configuration file for libsdp(3LIB), and is used to select which sockets will be using SDP and which will not.
There are 2 main types of statements supported by this configuration file:
.TP
\fB\ "use")
which defines the address family to be used for the sockets that match the line
.TP
\fB\ "log")
for setting logging related configuration. As the log settings takes immidiate effect we define these at the beggining of the file.

.SH DEAFUALT SETTINGS:
Get errors printed into the files /tmp/libsdp.log.<uid>
or /var/log/<filename> for root:
.sp
.in +2
.nf

log min-level 9 destination file libsdp.log
.fi
.in -2

By default we let all servers and client try SDP first.
to exclude SDP add "use tcp" rules before these defaults.
.sp
.in +2
.nf
use both server * *:*
use both client * *:*
.fi
.in -2

.SS LOG CONFIGURATION:
The log directive allows the user to specify which and where debug and error
messages get sent. The log statement format is:
.sp
.in +2
.nf
log [destination stderr|syslog|file <filename>] [min-level <1-9>]
.fi
.in -2
.sp
.LP
The fields are defined as follows:
.sp
.ne 2
.mk
.na
\fB\fIdestination\fR\fR
.ad
.sp .6
.RS 4n
defines the destination of the log messages:
.TP 5
\fB\ "stderr")
messages will be forwarded to the stderr

.TP 5
\fB\ "syslog")
messages sent to the  syslog  service

.TP 5
\fB\ "file <filename>")
messages will be written to the file /var/log/<filename> for root.
for regular user, if full path is requsted <filename with path>.<uid>
or /tmp/<filename>.<uid> if no path is requested
.RE
.ne 2
.mk
.na
\fB\fImin-level\fR\fR
.ad
.sp .6
.RS 4n
defines the verbosity of the log:
.TP 5
\fB\9)
only errors are printed
.TP 5
\fB\8)
warnings
.TP 5
\fB\7)
connect and listen summary (useful for tracking SDP usage)
.TP 5
\fB\4)
positive match summary (useful for config file debug)
.TP 5
\fB\3)
negative match summary (useful for config file debug)
.TP 5
\fB\2)
function calls and return values
.TP 5
\fB\1)
debug messages

.SH SOCKET ADDRESS FAMILY CONTROL

The socket control statements allows the user to specify when libsdp will
replace AF_INET_SDP/SOCK_STREAM sockets with AF_SDP/SOCK_STREAM
sockets. Each control statement specifies a matching rule that all its
subexpressions must evaluate as true (logical and) to apply.
.PP
The statements that control which type of sockets to open are made
of the following:

.sp
.in +2
.nf
use <address-family> <role> <program name> <address|*>:<port range|*>
.fi
.in -2
.PP
where

.ne 2
.mk
.na
\fB\fI<address-family>\fR\fR
.ad
.sp .6
.RS 4n
can be one of:
.TP 5
\fB\ "sdp")
for specifying when an SDP should be used
.TP 5
\fB\ "tcp")
for specifying when SDP socket should not be matched
.TP 5
\fB\ "both")
for specifying when both SDP and AF_INET sockets should be used.
.PP
Note: that "both" semantics is different between "server" and "client" roles:
For a "server" is means that the server will be listening on both sdp and tcp
For a "client" the connect will prefer using sdp but will silently
fall back to tcp if the sdp connection failed.
.RE

.ne 2
.mk
.na
\fB\fI<role>\fR\fR
.ad
.sp .6
.RS 4n
can be one of:
.TP 5
\fB\ "server" or "listen")
for defining the listening port address family
.TP 5
\fB\ "client" or "connect")
for defining the connected port address family
.RE


.ne 2
.mk
.na
\fB\fI<program-name|*>\fR\fR
.ad
.sp .6
.RS 4n
Defines the program name (not including the path) the rule applies to.
Wildcards with same semantics as "ls" are supported (* and ?).
So db2* would match on any program with a name starting with db2.
t?cp would match on ttcp, etc.
If not provided (default) the statement matches all programs.
.RE

.ne 2
.mk
.na
\fB\fI<address|*>\fR\fR
.ad
.sp .6
.RS 4n
Either the local address the server is bound to or the remote server
address the client connects to. Syntax for address matching is:
.PP
<IPv4 address>[/<prefix_length>]|*
.PP
IPv4 address = [0-9]+\.[0-9]+\.[0-9]+\.[0-9]+ each sub number < 255
.PP
prefix_length = [0-9]+ and with value <= 32. A prefix_length of 24
matches the subnet mask 255.255.255.0 . A prefix_length of 32
requires matching of the exact IP.
.RE

.ne 2
.mk
.na
\fB\fI<port range>\fR\fR
.ad
.sp .6
.RS 4n
start-port[-end-port] where port numbers are >0 and < 65536
.RE
.PP
Rules are evaluated in order of definition. So the first match wins.
If no match is made libsdp will default to "both".
.SH EXAMPLES
.HP
LOG CONFIGURATION:
.Br
.br
.PP
.LP


.TP 1
\fB\ Example 1:
Get SDP usage per connect and listen into stderr
.sp
.in +5
log min-level 7 destination stderr
.nf
.in -5

.TP 1
\fB\ Example 2:
Send errors only into syslog
.sp
.in +5
log min-level 9 destination syslog
.nf
.in -5
.RE

.HP
SOCKET ADDRESS FAMILY CONTROL

.TP 1
\fB\ Example 1:
Use SDP by clients connecting to machines that belongs to subnet 192.168.1.*
.sp
.in +5
.nf
#   family role    program   address:port[-range]
use sdp    connect *         192.168.1.0/24:*
.in -5

.TP 1
\fB\ Example 2:
Use SDP by ttcp when it connects to port 5001 of any machine
.sp
.in +5
.nf
#   family role    program   address:port[-range]
use sdp    listen  ttcp      *:5001
.in -5

.TP 1
\fB\ Example 3:
Use TCP for any program with name starting with ttcp* serving ports 22 to
25
.sp
.in +5
.nf
#   family role    program   address:port[-range]
use tcp    server  ttcp*     *:22-25
.in -5

.TP 1
\fB\ Example 4:
Listen on both TCP and SDP by any server that listen on port 8080
.sp
.in +5
.nf
#   family role    program   address:port[-range]
use both   server  *         *:8080
.in -5

.TP 1
\fB\ Example 5:
Connect ssh through SDP and fallback to TCP to hosts on 11.4.8.* port 22
.sp
.in +5
.nf
#   family role    program   address:port[-range]
use both   connect *         11.4.8.0/24:22
.in -5

.RE
.PP

NOTE: If all "use" rules are commented SDP will take "simple SDP"
mode and use SDP for all connections

 
.RE

.SH SEE ALSO
.sp
.LP
\fBlibsdp\fR(3LIB), \fBattributes\fR(5)


